<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8" language="java"  pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="spring" uri="/WEB-INF/lib/spring.tld"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<%@ taglib prefix="z" uri="/WEB-INF/lib/zerdoor.tld"%>
<c:set value="${pageContext.request.contextPath}" var="path" scope="page"/>


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><spring:message code='artist_production.title.msg' /></title>
    <link href="${path}/style/acg/css/style.css" rel="stylesheet" type="text/css" />
    <script src="${path}/js/jquery.min.js" type="text/javascript"></script>
    <%--<script type="text/javascript" src="${path}/style/acg/js/common.js"></script>--%>

    <link href="${path}/plugins/page/kkpager.css" rel="stylesheet">
    <script src="${path}/plugins/page/kkpager.js" type="text/javascript"></script>

<script type="text/javascript">

    $(function(){

        initBeanInfo(1,12);
        f_aClick("#orderSpan a","#orderBy");
    });


    var pageSize = 10;

    function initBeanInfo(page, rows) {

        /***设置查询数据*/
        var photo_id = "${photo_id}";
        var orderBy = $("#orderBy").val();//排序

        var param = {rows:rows, page:page, photo_id:photo_id,orderBy:orderBy
        };


        pageSize = rows;

        $.ajax({
            type: "POST",
            url: "${path}/artistPersonalHome/findUserProductionByPhotoId.html",
            data: param,
            dataType: "json",
            success: function(data){

                var html = "";
                for(var i in data.list){

                    var bean = data.list[i];

                    html += "<div class=\"list_item2\">";
                    html += "<div class=\"litop\"></div>";
                    html += "<div class=\"limain clearfix\">";
                    html += "<div class=\"liimg\"><a href=\"javascript:f_toProduction('"+bean.works_id+"')\"><img src='${path}/"+bean.cover+"'  title='"+bean.works_name+"' width=\"292\" height=\"180\" /></a></div>";
                    html += "<div class=\"licon\">";
                    html += "<h3><a href=\"javascript:f_toProduction('"+bean.works_id+"')\">"+bean.works_name+"</a></h3>         ";
                    html += "<p class=\"sellnum\">";
                    html += "<span><spring:message code='artist_production.msg.sold' />："+bean.sale_num+"</span><spring:message code='artist_production.msg.sellingPrice' />：￥" +bean.price;
                    html += "</p>";
                    html += "</div>";
                    html += "<div class=\"clr\"></div>";
                    html += "</div>";
                    html += "<div class=\"lifoot\"></div>";
                    html += "</div>";

                }


                $("#dataDiv").html(html);

                var pager = data;
                //分页
                createPage(pager.pageNum, pager.pages, pager.total);

            }
        });
    }


    //分页方法
    //currentPage 当前页
    //rows 每页条数
    //total 总数
    function createPage(currentPage, totalPage, totalCount) {
        var totalPage = totalPage;
        var totalRecords = totalCount;
        var pageNo = currentPage;
        if (!pageNo) {
            pageNo = 1;
        }
        //生成分页
        //有些参数是可选的，比如lang，若不传有默认值
        kkpager.generPageHtml({
            pno: pageNo,
            //总页码
            total: totalPage,
            //总数据条数
            totalRecords: totalRecords,
            //链接前部
            hrefFormer: 'index',
            //链接尾部
            hrefLatter: '',
            //是否显示总页数
            isShowTotalPage: true,
            //是否显示总记录数
            isShowTotalRecords: true,
            //是否显示页码跳转输入框
            isGoPage: true,
            //getLink: function (n) {
            //    return this.hrefFormer + this.hrefLatter + "?pno=" + n;
            //}
            //,
            mode : 'click',//默认值是link，可选link或者click
            click : function(n){
                //this.selectpage(n);
                initBeanInfo(n, pageSize);
                return false;
            },
            lang				: {
                firstPageText			: '<spring:message code="firstPageText"/>',
                firstPageTipText		: '<spring:message code="firstPageTipText"/>',
                lastPageText			: '<spring:message code="lastPageText"/>',
                lastPageTipText			: '<spring:message code="lastPageTipText"/>',
                prePageText				: '<spring:message code="prePageText"/>',
                prePageTipText			: '<spring:message code="prePageTipText"/>',
                nextPageText			: '<spring:message code="nextPageText"/>',
                nextPageTipText			: '<spring:message code="nextPageTipText"/>',
                totalPageBeforeText		: '<spring:message code="totalPageBeforeText"/>',
                totalPageAfterText		: '<spring:message code="totalPageAfterText"/>',
                totalRecordsAfterText	: '<spring:message code="totalRecordsAfterText"/>',
                gopageBeforeText		: '<spring:message code="gopageBeforeText"/>',
                gopageButtonOkText		: '<spring:message code="gopageButtonOkText"/>',
                gopageAfterText			: '<spring:message code="gopageAfterText"/>',
                buttonTipBeforeText		: '<spring:message code="buttonTipBeforeText"/>',
                buttonTipAfterText		: '<spring:message code="buttonTipAfterText"/>'
            }
        },true);
    }

    /**a点击事件 传入选择器*/
    function f_aClick(selID,inputID){



        $(selID).click(function() {
            $(selID).removeClass("on");

            $(this).addClass("on");

            if(inputID != null && inputID != undefined){

                $(inputID).val($(this).attr("value"));
            }

            initBeanInfo(1,12);

        });

    }


    /**
     * 跳转作品信息
     * @param production_id 作品ID
     */
    function f_toProduction(production_id){

        window.location.href = "${path}/artistPersonalHome/browseProduction.html?production_id="+production_id;

    }

    </script>

</head>

<body>
<div class="header">
    <jsp:include page="../public/header.jsp">
        <jsp:param    name="home"    value="dddd"    />
    </jsp:include>
</div>
<div id="container">
    <div class="wrapper">
        <div class="listbox">
            <div class="modetitle">
                <spring:message code='artist_special.msg.currentLocation' />：<a href="${path}">ACG</a> >
                <a href="${path}/artistPersonalHome/artistPersonalHome.html?receiver=${navigation.artist_id}"><spring:message code='artist_special.msg.homepage' arguments='${navigation.real_name}' argumentSeparator=','/></a> >
                <a href="${path}/artistPersonalHome/artistPersonalSpecial.html?artistId=${navigation.artist_id}"><spring:message code='artist_special.msg.collections' /></a> >
                ${navigation.photo_name}
                <span id="orderSpan">
                	<a value="publish_time desc" class="on"><spring:message code='artist_production.order.uploadTime' /></a>
                	<a value="click_rate desc"><spring:message code='artist_production.order.heat' /></a>
                	<a value="price desc"><spring:message code='artist_production.order.sellingPrice' /></a>
                    <input id="orderBy" type="hidden" value="publish_time desc">
                </span>
            </div>
            <div class="reelscontainer">
                <div class="listview clearfix" id="dataDiv">


                    <div class="clr"></div>
                </div>
                <div class="pagebox">
                    <div class="pagebox">
                        <div id="kkpager" style="text-align: center"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="footer">
    <!--content-->
    <jsp:include page="../public/footer.jsp"></jsp:include>

</div>

</body>
</html>
